// 根据角色动态生成路由
import { defineFakeRoute } from "vite-plugin-fake-server/client";

// export default
  defineFakeRoute([
    {
      url: "/system/system/v2/user/login",
      method: "post",
      response: ({ body }) => {
        return {
          code: 200,
          msg: "成功",
          result: {
            accessToken:
              "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6MSwiTmFtZSI6IiIsIkxvZ2luUGxhdGZvcm0iOjQsIlVzZVBsYXRmb3JtIjozLCJMaWNlbnNlZXNJZCI6MCwiQnVzaW5lc3NJZCI6MCwiYXVkIjpbInNqIl0sImV4cCI6MTcwMDExMjkxMiwibmJmIjoxNjk4ODE2OTEyfQ.6YKTlguQtn6P_MAGBETaezs_1VrYZtm_ILY-UXHeOfw",
            sessionKey: "GAO2tnC8cQYLpRQACojjew=="
          }
        };
      }
    },
    {
      url: "/system/system/v2/user/login-phone",
      method: "post",
      response: ({ body }) => {
        return {
          code: 200,
          msg: "成功",
          result: {
            accessToken:
              "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6MSwiTmFtZSI6IiIsIkxvZ2luUGxhdGZvcm0iOjQsIlVzZVBsYXRmb3JtIjozLCJMaWNlbnNlZXNJZCI6MCwiQnVzaW5lc3NJZCI6MCwiYXVkIjpbInNqIl0sImV4cCI6MTcwMDExMjkxMiwibmJmIjoxNjk4ODE2OTEyfQ.6YKTlguQtn6P_MAGBETaezs_1VrYZtm_ILY-UXHeOfw",
            sessionKey: "GAO2tnC8cQYLpRQACojjew=="
          }
        };
      }
    },
    {
      url: "/system/system/v2/user/self",
      method: "get",
      response: ({ body }) => {
        return {
          "code": 200,
          "msg": "",
          "result": {
            "permissions": ["sys"],
            "userInfo": {
              "id": 1,
              "nickname": "1weq",
              "phone": "123131",
              "allowPortal": [1, 4],
              "lastLoginTime": "2022-09-01 15:15:13",
              "lastLoginIp": "1.1.1.1",
              "roleName": "管理员",
              "loginName": "",
              "unityId": 0,
              "unityName": "",
              "roleIds": [],
              "roles": [{
                "id": "",
                "roleName": ""
              }]
            }
          }
        }
      }
    },
    {
      url: "/system/system/v2/user/captcha ",
      method: "get",
      response: ({ body }) => {
        return {
          code: 200,
          msg: "",
          result: {
            captchaId: "3FnFyGKDA208XJxDM3BC",
            captchaImg:
              ""
          }
        };
      }
    },
    {
      url: "/system/system/v2/user/code",
      method: "post",
      response: ({ body }) => {
        return {
          code: 200,
          msg: "发送成功",
          result: {}
        };
      }
    },
    {
      url: "/system/system/v2/user/logout",
      method: "post",
      response: ({ body }) => {
        return {
          code: 200,
          msg: "退出成功",
          result: {}
        };
      }
    },
    {
      url: "/system/system/v2/user/password",
      method: "put",
      response: ({ body }) => {
        return {
          code: 200,
          msg: "修改成功",
          result: {}
        };
      }
    },
    {
      url: "/system/system/v2/user/self",
      method: "put",
      response: ({ body }) => {
        return {
          code: 200,
          msg: "修改成功",
          result: {}
        };
      }
    }
  ]);
